import Vue from 'vue'
import Router from 'vue-router'

import login from '@/components/login/login' //登录
import forgotPwd from '@/components/login/forgotPwd' //登录
import register from '@/components/register/register' //注册
import agreement from '@/components/xieyi/agreement' //协议
import privacy from '@/components/xieyi/privacy' //隐私
import about from '@/components/about/about' //隐私
import home from '@/components/home/home' //首页

// 打包app
import packageAPP from '@/components/packApp/packageAPP' //打包APP
import createApp from '@/components/packApp/createApp' //新建应用
import createMsg from '@/components/packApp/createMsg' //新建记录
import editApp from '@/components/packApp/editApp/editApp' //打包APP的编辑应用
import editMyApp from '@/components/packApp/editApp/editMyApp' //编辑应用
import createMyApp from '@/components/packApp/editApp/createMyApp' //生成安装包



import adhibition from '@/components/adhibitionMember/adhibition' //我的应用
import appList from '@/components/adhibitionMember/app' //我的应用列表
import upfile from '@/components/adhibitionMember/upfile' //我的应用上传
import mergeApplication from '@/components/adhibitionMember/mergeApplication.vue' //应用合并
import importLink from '@/components/adhibitionMember/importLink.vue' //导入外部链接合并

import signatureSuper from '@/components/signatureSuperMember/signatureSuper' //超级签名
import upfileSuper from '@/components/signatureSuperMember/upfileSuper' //超级签名上传
import appSuper from '@/components/signatureSuperMember/app' //应用详情
import authCode from '@/components/signatureSuperMember/authCode' //授权码管理
import p8Account from '@/components/signatureSuperMember/p8Account' //p8账号开发

import enterprise from '@/components/enterpriseMember/enterprise' //企业签名
import appFirm from '@/components/enterpriseMember/app' //企业签名列表
import upfileFirm from '@/components/enterpriseMember/upfileFirm' //企业签名上传
import enterprise_detail_left from '@/components/enterpriseMember/detail/detail_left' //企业签名详情
import enterprise_detailInfo from '@/components/enterpriseMember/detail/detailInfo' //企业签名应用详情
import enterprise_downList from '@/components/enterpriseMember/detail/downlist' //企业签名下载明细
import enterprise_setting from '@/components/enterpriseMember/detail/setting' //应用设置

import signatureTF from '@/components/signatureTFMember/signatureTF' //TF签名
import price from '@/components/priceMember/price' //价格
import postting from '@/components/posttingMember/postting' //封装
import workbox from '@/components/workboxMember/workbox' //工具箱
import document from '@/components/documentMember/document' //文档
import purchase from '@/components/signatureSuperMember/purchase' //购买
import super_downlist_all from '@/components/signatureSuperMember/downlist_all' //签名设备明细
import signatureSuper_detail from '@/components/signatureSuperMember/detail/detail_left' //超级签名详情
import adhibition_detail from '@/components/adhibitionMember/detail/detail_left' //我的应用详情
import account_account from '@/components/account/account' //个人中心
import workUDID from '@/components/workboxMember/UDID' //UDID获取
import workPlist from '@/components/workboxMember/Plist' //Plist获取
import workAppIcon from '@/components/workboxMember/AppIcon' //图标制作
import workSelfhelp from '@/components/workboxMember/selfhelp' //自助签名
import workonlineTest from '@/components/workboxMember/onlineTest' //在线测试

import wechat from '@/components/priceMember/wechat' //微信支付设备
import mealPay from '@/components/priceMember/mealPay' //微信支付设备
import detail_left from '@/components/adhibitionMember/detail/detail_left' //我的应用详情
import detailInfo from '@/components/adhibitionMember/detail/detailInfo' //应用详情
import downList from '@/components/adhibitionMember/detail/downlist' //下载明细
import setting from '@/components/adhibitionMember/detail/setting' //应用设置
import signCom from '@/components/adhibitionMember/detail/signCom' //企业签名
import detailInfoto from '@/components/account/detailInfo' //用户信息

import agency from '@/components/account/agency' //我的代理
import information from '@/components/account/information' //我的消息
import orderlist from '@/components/account/orderlist' //用户订单信息
import realName from '@/components/account/uploadID/realName' //实名认证
import uploadUserId from "@/components/account/uploadID/uploadUserId" //个人认证填写资料
import uploadEnterprise from "@/components/account/uploadID/uploadEnterprise" //企业认证
import checkID from "@/components/account/uploadID/checkID" //个人认证填写资料
import detailSuper from '@/components/adhibitionMember/detail/detail_left' //超级签名详情
import superInfo from '@/components/adhibitionMember/detail/detailInfo' //签名应用详情
import superSetting from '@/components/adhibitionMember/detail/downlist' //签名应用设置
import superDownList from '@/components/adhibitionMember/detail/setting' //签名设备明细

import appPackaging from '@/components/appPackagingMember/appPackaging.vue' //App封装
import iosVisaFree from '@/components/appPackagingMember/iosVisaFree.vue' //苹果免签封装
import visaRecord from '@/components/appPackagingMember/visaRecord.vue' //封装记录
import payIosVisaFree from '@/components/appPackagingMember/payIosVisaFree.vue' //购买

import news from '@/components/news/news.vue' //购买



import test from '@/components/Yee/test.vue'

Vue.use(Router)

// 解决路由导航冗余报错（路由重复）
const originalPush = Router.prototype.push
Router.prototype.push = function push(location) {
  return originalPush.call(this, location).catch(err => err)
}

const router = new Router({
  // mode: "history", //改变路由为history模式
  routes: [{
      path: '/',
      name: 'home',
      component: home
    },
    // {
    //   path: '/home',
    //   name: 'home',
    //   component: home
    // },
    {
      path: '/login',
      name: 'login',
      component: login
    },
    {
      path: '/packageAPP',
      name: 'packageAPP',
      component: packageAPP,
      children: [{
          path: '/createApp',
          name: 'createApp',
          component: createApp
        },
        {
          path: '/createMsg',
          name: 'createMsg',
          component: createMsg
        },
      ]
    },
    {
      path: '/editApp',
      name: 'editApp',
      component: editApp,
      register: '/editMyApp',
      children: [{
          path: '/editMyApp',
          name: 'editMyApp',
          component: editMyApp
        },
        {
          path: '/createMyApp',
          name: 'createMyApp',
          component: createMyApp
        },
      ]
    },
    {
      path: '/register',
      name: 'register',
      component: register
    },
    {
      path: '/forgotPwd',
      name: 'forgotPwd',
      component: forgotPwd
    },
    {
      path: '/agreement',
      name: 'agreement',
      component: agreement
    },
    {
      path: '/privacy',
      name: 'privacy',
      component: privacy
    },
    {
      path: '/about',
      name: 'about',
      component: about
    },
    // {
    //   path: '/adhibition',
    //   name: 'adhibition',
    //   component: adhibition
    // },
    // {
    //   path: '/signatureSuper',
    //   name: 'signatureSuper',
    //   component: signatureSuper
    // },
    {
      path: '/signatureTF',
      name: 'signatureTF',
      component: signatureTF
    },
    {
      path: '/price',
      name: 'price',
      component: price
    },
    {
      path: '/postting',
      name: 'postting',
      component: postting
    },
    {
      path: '/workbox',
      name: 'workbox',
      component: workbox
    },
    {
      path: '/document',
      name: 'document',
      component: document
    },
    {
      path: '/signatureSuper_detail',
      name: 'signatureSuper_detail',
      component: signatureSuper_detail
    },
    {
      path: '/adhibition_detail',
      name: 'adhibition_detail',
      component: adhibition_detail
    },
    {
      path: '/realName',
      name: 'realName',
      component: realName
    },
    {
      path: '/uploadUserId',
      name: 'uploadUserId',
      component: uploadUserId
    },
    {
      path: '/uploadEnterprise',
      name: 'uploadEnterprise',
      component: uploadEnterprise
    },
    {
      path: '/checkID',
      name: 'checkID',
      component: checkID
    },
    {
      path: '/workPlist',
      name: 'workPlist',
      component: workPlist
    }, {
      path: '/workSelfhelp',
      name: 'workSelfhelp',
      component: workSelfhelp
    }, {
      path: '/workonlineTest',
      name: 'workonlineTest',
      component: workonlineTest
    },
    {
      path: '/purchase',
      name: 'purchase',
      component: purchase
    },
    {
      path: '/workUDID',
      name: 'workUDID',
      component: workUDID
    },
    {
      path: '/workAppIcon',
      name: 'workAppIcon',
      component: workAppIcon
    },
    {
      path: '/wechat',
      name: 'wechat',
      component: wechat
    },
    {
      path: '/mealPay',
      name: 'mealPay',
      component: mealPay
    },
    {
      path: '/importLink',
      name: 'importLink',
      component: importLink
    },
    {
      path: '/adhibition',
      name: 'adhibition',
      component: adhibition,
      children: [{
          path: '/appList',
          name: 'appList',
          component: appList
        },
        {
          path: '/upfile',
          name: 'upfile',
          component: upfile
        },
        {
          path: '/mergeApplication',
          name: 'mergeApplication',
          component: mergeApplication
        },
      ]
    },
    {
      path: '/appPackaging',
      name: 'appPackaging',
      component: appPackaging,
      redirect: '/iosVisaFree',
      children: [{
          path: '/iosVisaFree',
          name: 'iosVisaFree',
          component: iosVisaFree
        },
        {
          path: '/visaRecord',
          name: 'visaRecord',
          component: visaRecord
        },
      ]
    },
    {
      path: '/payIosVisaFree',
      name: 'payIosVisaFree',
      component: payIosVisaFree
    },
    {
      path: '/enterprise',
      name: 'enterprise',
      component: enterprise,
      children: [{
          path: '/appFirm',
          name: 'appFirm',
          component: appFirm
        },
        {
          path: '/upfileFirm',
          name: 'upfileFirm',
          component: upfileFirm
        },

      ]
    },
    {
      path: '/enterprise_detail_left',
      name: 'enterprise_detail_left',
      component: enterprise_detail_left,
      children: [{
          path: '/enterprise_detailInfo',
          name: 'enterprise_detailInfo',
          component: enterprise_detailInfo
        },
        {
          path: '/enterprise_downList',
          name: 'enterprise_downList',
          component: enterprise_downList
        },
        {
          path: '/enterprise_setting',
          name: 'enterprise_setting',
          component: enterprise_setting
        },
      ]
    },
    {
      path: '/account_account',
      name: 'account_account',
      component: account_account,
      children: [{
          path: '/detailInfoto',
          name: 'detailInfoto',
          component: detailInfoto
        },
        {
          path: '/orderlist',
          name: 'orderlist',
          component: orderlist
        }, {
          path: '/agency',
          name: 'agency',
          component: agency
        }, {
          path: '/information',
          name: 'information',
          component: information
        },

      ]
    },
    {
      path: '/detail_left',
      name: 'detail_left',
      component: detail_left,
      children: [{
          path: '/detailInfo',
          name: 'detailInfo',
          component: detailInfo
        },
        {
          path: '/downList',
          name: 'downList',
          component: downList
        },
        {
          path: '/setting',
          name: 'setting',
          component: setting
        },
        {
          path: '/signCom',
          name: 'signCom',
          component: signCom
        },
      ]
    },
    {
      path: '/signatureSuper',
      name: 'signatureSuper',
      component: signatureSuper,
      children: [{
          path: '/appSuper',
          name: 'appSuper',
          component: appSuper,
        },
        {
          path: '/super_downlist_all',
          name: 'super_downlist_all',
          component: super_downlist_all,
        },
        {
          path: '/upfileSuper',
          name: 'upfileSuper',
          component: upfileSuper,
        },
        {
          path: '/authCode',
          name: 'authCode',
          component: authCode,
        },
        {
          path: '/p8Account',
          name: 'p8Account',
          component: p8Account,
        }
      ]
    },
    {
      path: '/detailSuper',
      name: 'detailSuper',
      component: detailSuper,
      children: [{
          path: '/superInfo',
          name: 'superInfo',
          component: superInfo
        },

        {
          path: '/superSetting',
          name: 'superSetting',
          component: superSetting
        },
        {
          path: '/superDownList',
          name: 'superDownList',
          component: superDownList
        },
      ]
    }, {
      path: '/news',
      name: 'news',
      component: news,
    }
  ]

})


// //push 
// const VueRouterPush = Router.prototype.push
// Router.prototype.push = function push(to) {
//   return VueRouterPush.call(this, to).catch(err => err)
// }

// //replace
// const VueRouterReplace = Router.prototype.replace
// Router.prototype.replace = function replace(to) {
//   return VueRouterReplace.call(this, to).catch(err => err)
// }
export default router
